package com.soft.bams.client;

import javax.swing.*;
import java.awt.*;

public class MainPanel extends JPanel {
    private ATMClient atmClient;

    public MainPanel(ATMClient atmClient) {
        this.atmClient = atmClient;
        setLayout(null);
        initComponents();
    }

    private void initComponents() {
        JLabel titleLabel = new JLabel("欢迎使用ATM系统", JLabel.CENTER);
        titleLabel.setFont(new Font("宋体", Font.BOLD, 24));
        titleLabel.setBounds(150, 50, 300, 40);
        add(titleLabel);

        JButton registerBtn = new JButton("开户");
        registerBtn.setBounds(200, 150, 200, 40);
        registerBtn.addActionListener(e -> atmClient.showPanel("Register"));
        add(registerBtn);

        JButton loginBtn = new JButton("登录");
        loginBtn.setBounds(200, 220, 200, 40);
        loginBtn.addActionListener(e -> atmClient.showPanel("Login"));
        add(loginBtn);
    }
}
